package aps

import glory.xxd.Utils
import org.json.JSONObject

class StartTestController {

    def commentService

    def index() {

        def USERNAME = params.USERNAME ?: ""
        def LOTID = params.LOTID ?: ""
        def EQPID = params.EQPID ?: ""
        def REMAKE = params.REMAKE ?: ""

        def body = JSONObject.newInstance()
        body.put("USERNAME", USERNAME)
        body.put("LOTID", LOTID)
        body.put("EQPID", EQPID)
        body.put("REMAKE", REMAKE)

        String logUUID = Utils.getUUID();
        def header = JSONObject.newInstance()
        header.put("MESSAGENAME", "StartTest")
        header.put("TRANSACTIONID", logUUID)
        header.put("USERNAME", 'EAP')

        def jsonAll = [Header: header, Body: body] //JSONObject.newInstance()
        //        jsonAll.put("Body",body)
        //        jsonAll.put("Header",header)
        def jsonRequest = JSONObject.newInstance()
        jsonRequest.put("Request", jsonAll)

        def json = commentService.getJsonByJsonForTopic2Queue(logUUID, jsonRequest)

        render json
    }
}